<?php
/**
 * 酒店房型关闭日期设置
 * User: lxq
 * Date: 2018/5/11
 * Time: 9:57
 */
defined('InNcPHP') or exit('Access Invalid!');
class hotel_close_dateModel extends Model{

    public function __construct(){
        parent::__construct('hotel_close_date');
    }


    /**
     * 要插入的值
     * @param array $params
     * @return mixed
     */
    public function addHotelSpecClose($params)
    {
        return $this->table('hotel_close_date')->insert($params);
    }

    /**
     * 获取某日酒店房型状态列表
     * @param array $condition 日期ID
     * @return mixed
     */
    public function getHotelSpecSkuList($condition = array())
    {
        return $this->table('hotel_close_date,spec')
            ->field('*')
            ->join('left')
            ->on('hotel_close_date.spec_id=spec.spec_id')
            ->where($condition)
            ->select();
    }

    /**
     * 获取一条规格信息
     * @param array $condition
     * @return mixed
     */
    public function getHotelSpecCloseInfo($condition = array())
    {
        return $this->table('hotel_close_date,spec')
            ->field('*')
            ->join('left')
            ->on('hotel_close_date.spec_id=spec.spec_id')
            ->where($condition)
            ->find();
    }

    /**
     * 更新sku
     * @param array $condition
     * @param array $params
     * @return mixed
     */
    public function updateHotelSpecClose($condition, $params)
    {
        return $this->table('hotel_close_date')->where($condition)->update($params);
    }

    /**
     * 删除sku
     * @param array $condition
     * @return mixed
     */
    public function delHotelSpecClose($condition)
    {
        return $this->table('hotel_close_date')->where($condition)->delete();
    }

}